from module_project.module1_practice import Timo, Jinx

class HeroFactory:
    def create_hero(self,hero_name):
        if hero_name=="timo":
            return Timo()
        elif hero_name=="jinx":
            return Jinx()
        else:
            # 抛出异常
            raise Exception("该英雄不在工厂内")

if __name__=="__main":
    hero_factory=HeroFactory()
    timo=hero_factory.create_hero("timo")
    jinx=hero_factory.create_hero("jinx")
    jinx.fight(Timo.hero_hp, Timo.hero_power, Timo.hero_name)
